var api = require("../../utils/api.js");
Page({
  data: {
    hiddenTab: false,
    tabColor1: "#1890FF",
    tabColor2: "#5A5A5A",
    statusBarNumber: 0,
    statusBar: [{
      hidden: false,
    }, {
      hidden: true,
    }, {
      hidden: true,
    }, {
      hidden: true,
    }],
    contracts: [],
    user: {},
    arguments: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    api.client.getContractsAndCurrentUserByTaskId(function (res) {}, options.taskId, this);
    api.client.getEnquiryRecordArgumentsByTaskIdAndUserInfoId(options.taskId, this);
    api.client.getNotarialApplicationFormArgumentsByTaskIdAndUserInfoId(options.taskId, this);
    api.client.getAcceptanceNoticeAndNotificationArgumentsByTaskIdAndUserInfoId(options.taskId, this);
    api.client.getLetterOfCommitmentArgumentsByTaskIdAndUserInfoId(options.taskId, this);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  tab1A() {
    this.setData({
      hiddenTab: false,
      tabColor1: "#1890FF",
      tabColor2: "#5A5A5A"
    });
  },
  tab2A() {
    this.setData({
      hiddenTab: true,
      tabColor1: "#5A5A5A",
      tabColor2: "#1890FF"
    });
  },
  tab1() {
    this.changeTab(this.data.statusBarNumber, 0);
  },
  tab2() {
    this.changeTab(this.data.statusBarNumber, 1);
  },
  tab3() {
    this.changeTab(this.data.statusBarNumber, 2);
  },
  tab4() {
    this.changeTab(this.data.statusBarNumber, 3);
  },
  changeTab(original, next) {
    this.setData({
      ["statusBar[" + original + "].background"]: "#F5F5F5",
      ["statusBar[" + original + "].color"]: "#565656",
      ["statusBar[" + original + "].border"]: "2rpx solid #D9D9D9",
      ["statusBar[" + original + "].hidden"]: true,
      ["statusBar[" + next + "].background"]: "#E6F7FF",
      ["statusBar[" + next + "].color"]: "#1890FF",
      ["statusBar[" + next + "].border"]: "2rpx solid #91D5FF",
      ["statusBar[" + next + "].hidden"]: false,
      statusBarNumber: next
    });
  }
})